<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>计时器</title>
	<style type="text/css">
		
		*{
			color: #FFFFFF;
		}
		
		.beiji{
			width: 185px;
			height: 280px;
			background: url(jd.png);
			
		}
		.djs{
			color: #fff;
			text-align: center;
			padding-top: 20px;
		}
		.sc{
			color: #fff;
			text-align: center;
			padding-top: 105px;
		}
		#h1{
			color: #fff;
			text-align: center;
			padding-top: 7px;
			font-size: 18px;
		}
		#m1{
			color: #fff;
			text-align: center;
			padding-top: 7px;
			font-size: 18px;
		}
		#s1{
			color: #fff;
			text-align: center;
			padding-top: 7px;
			font-size: 18px;
		}
		.jz{
			text-align: center;
		}
	</style>
</head>
<body>
	<div class="beiji">
		<h2 class="djs">
			倒计时
		</h2>
		
		<p class="sc">23:59:59点场 倒计时</p>
		<div class="jz">
			<span id="h1">00</span> :
			<span id="m1">00</span> :
			<span id="s1">00</span>
		</div>
		
		
		
	</div>
</body>
		<script type="text/javascript">
			
			
			
			var h4689 = setInterval(function(){
				
				
				var h2 = 23;
				var m2 = 59;
				var s2 = 59;
				var h = h2 - new Date().getHours();
				var m = m2 - new Date().getMinutes();
				var s = s2 - new Date().getSeconds();
				
				h1.innerHTML = h;
				m1.innerHTML = m;
				s1.innerHTML = s;
				if (h<10) {
					h1.innerHTML = '0' + h;
				} else{
					h1.innerHTML = h;
				}
				if (m<10) {
					m1.innerHTML = '0' + m;
				} else{
					m1.innerHTML = m;
				}
				if (s<10) {
					s1.innerHTML = '0' + s;
				} else{
					s1.innerHTML = s;
				}
				console.log(h);
			},10);
			
			// 如果时间小于0 那么就会停止

            if(jz <=0){
                  clearInterval(t)               
                  console.log("秒杀时间结束")                           
            }

            document.querySelector("#h1").innerHTML= h2;
            document.querySelector("#m1").innerHTML= m2;
            document.querySelector("#s1").innerHTML= s2;

                seckill()
            
            var t = setInterval(seckill,1000)

		</script>
</html>